#ifndef __PLATFORM_OAI_CACHE_H__
#define __PLATFORM_OAI_CACHE_H__

#include "platform/oTypes.h"

namespace platform
{
	class oCompare;
	class oAILeaf;
	class oInstinct;

	class oDLL oAICache: public CCSAXDelegator
	{
		typedef hash_strmap<oAILeaf*> oReflexMap;
		typedef hash_strmap<oInstinct*> oInstinctMap;
	public:
		static oRelation relation;
		static string propName;
		static uint32 type;
		static uint32 action;
		static int tag;
		static oCompare* compareOne;
		static oCompare* compareTwo;
		~oAICache();
		void load(const char* filename);
		void unload();
		oAILeaf* getReflexArc(const string& name);
		oInstinct* getInstinct(const string& name);
		static oAICache& sharedCache();
	private:
		oAICache();
		virtual void textHandler( void *ctx, const char *s, int len );
		virtual void startElement( void *ctx, const char *name, const char **atts );
		virtual void endElement( void *ctx, const char *name );
		int _conIndex;
		uint32 _op;
		string _propName;
		string _currentItemName;
		stack<oAILeaf*> _nodeStack;
		stack<oCompare*> _compareStack;
		oInstinct* _currentInstinct;
		oReflexMap _reflexArcs;
		oInstinctMap _instincts;
		CCSAXParser _parser;
	};
}

#endif